'''
Created on 2010-4-14

@author: chengmeng
'''

	
class IPlugin():

	def IHelp(self):
		pass

	def IBeginLoadScene(self):
		pass
	
	def IEndLoadScene(self):
		pass
	
	def IUpdateScene(self):
		pass
	
	def IClearScene(self):
		pass

	def IShutdowm(self):
		pass
	
	pass


class Plugins():
	def notify(self, event, state=None):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'I' + event):
				getattr(pp, 'I' + event)(data)
		pass

	def help(self):
		doc = ""
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IHelp'):
				doc += p
				doc += ' :\n'
				doc += getattr(pp, 'IHelp')()
				doc += "\n"
				doc += "\n"
				doc += """-----------------------------------------------------------------"""
				doc += "\n"
		return doc

	def beginLoadScene(self):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IBeginLoadScene'):
				getattr(pp, 'IBeginLoadScene')()
		pass

	def endLoadScene(self):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IEndLoadScene'):
				getattr(pp, 'IEndLoadScene')()
		pass

	def updateScene(self):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IUpdateScene'):
				getattr(pp, 'IUpdateScene')()
		pass

	def clearScene(self):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IClearScene'):
				getattr(pp, 'IClearScene')()
		pass

	def shutdowm(self):
		for p in dir(self):
			pp = getattr(self, p)
			if hasattr(pp, 'IShutdowm'):
				getattr(pp, 'IShutdowm')()
		pass
	pass

